x86/msr: Fix migration compatibility issue with MSR_SPEC_CTRL
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 19 Jan 2022 19:55:02 +0000 (19:55 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 4 Feb 2022 15:45:24 +0000 (15:45 +0000)
commit5f27e51cce99c422a7e506f9a0eeda195b767464
tree91932e988b2a1d339d0cad4e2da0a6cd373cf367
parent47dbbe3878a002bb9bfa7ab24c0e7dc57b894ac7
x86/msr: Fix migration compatibility issue with MSR_SPEC_CTRL

This bug existed in early in 2018 between MSR_SPEC_CTRL arriving in microcode,
and SSBD arriving a few months later.  It went unnoticed presumably because
everyone was busy rebooting everything.

The same bug will reappear when adding PSFD support.

Clamp the guest MSR_SPEC_CTRL value to that permitted by CPUID on migrate.
The guest is already playing with reserved bits at this point, and clamping
the value will prevent a migration to a less capable host from failing.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
(cherry picked from commit 969a57f73f6b011b2ebf4c0ab1715efc65837335)
xen/arch/x86/hvm/hvm.c
xen/arch/x86/msr.c
xen/include/asm-x86/msr.h